package com.phiture.erp.produce.core.convert;

import com.phiture.erp.produce.core.pojo.dto.ErpCreateMaterialRequirementPlanItemsDTO;
import com.phiture.erp.produce.core.pojo.dto.ErpMaterialRequirementsDTO;
import com.phiture.erp.produce.core.pojo.vo.ErpMaterialRequirementPlanItemVO;
import com.phiture.erp.produce.dal.entity.ErpMaterialRequirementPlanItemsDO;
import com.phiture.erp.purchase.api.pojo.req.CreatePurchaseRequestFromMrpReq;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface ErpMaterialRequirementPlanConvertMapper {
    ErpMaterialRequirementPlanConvertMapper INSTANCE = Mappers.getMapper(ErpMaterialRequirementPlanConvertMapper.class);

    @Mappings({
            @Mapping(target = "id", ignore = true),
            @Mapping(target = "materialRequirementPlanId", ignore = true),
            @Mapping(target = "status", expression = "java(com.phiture.erp.produce.common.enums.MrpReleaseStatusEnum.UNRELEASED.getStatus())")
    })
    ErpMaterialRequirementPlanItemsDO toErpMaterialRequirementPlanItemsDO(ErpCreateMaterialRequirementPlanItemsDTO dto);
    List<ErpMaterialRequirementPlanItemsDO> toErpMaterialRequirementPlanItemsDOList(List<ErpCreateMaterialRequirementPlanItemsDTO> dtoList);

    ErpCreateMaterialRequirementPlanItemsDTO toErpCreateMaterialRequirementPlanItemsDTO(ErpMaterialRequirementsDTO dto);
    ErpMaterialRequirementPlanItemVO toErpMaterialRequirementPlanItemVO(ErpMaterialRequirementPlanItemsDO itemsDO);
    List<ErpMaterialRequirementPlanItemVO> toErpMaterialRequirementPlanItemVOList(List<ErpMaterialRequirementPlanItemsDO> itemsDOList);

    CreatePurchaseRequestFromMrpReq toCreatePurchaseRequestFromMrpReq(ErpMaterialRequirementPlanItemsDO itemsDO);
    List<CreatePurchaseRequestFromMrpReq> toCreatePurchaseRequestFromMrpReqList(List<ErpMaterialRequirementPlanItemsDO> items);


}
